<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>个人信息</title>
	<meta name="decorator" content="default"/>
	<script type="text/javascript">
		$(document).ready(function() {
			$("#inputForm").validate({
				submitHandler: function(form){
					loading('正在提交，请稍等...');
					form.submit();
				},
				errorContainer: "#messageBox",
				errorPlacement: function(error, element) {
					$("#messageBox").text("输入有误，请先更正。");
					if (element.is(":checkbox")||element.is(":radio")||element.parent().is(".input-append")){
						error.appendTo(element.parent().parent());
					} else {
						error.insertAfter(element);
					}
				}
			});
		});
		
		//头像上传后事件
		function afterUploaded(data){
			alert(data.url);
			console.log(data);
	    }
	</script>
</head>
<body>
	<div class="box-wrapper">
	<form:form id="inputForm" modelAttribute="user" action="${ctx}/sys/user/info" method="post" class="form-horizontal">
<%-- 		<form:hidden path="email" htmlEscape="false" maxlength="255" class="input-xlarge"/> --%>
		<sys:message content="${message}"/>
		<div class=" box pat-15 box-first">
			<div class="title-left fl "><div class="head-box"><%@ include file="/WEB-INF/views/include/webupload.jsp"%></div></div>
			<div class="form-group no-margin">
				<div class="controls col-sm-8 pat-5">
					<p><b class="b-name">${user.name}</b><img src="/nplus1/static/images/1.png" class="role-icon"><span >超级管理员</span></p>
					<label class="no-margin">上次登录:</label></br>
					<label class="lbl form-control-static no-margin" style="font-weight:400;color:#999;">IP: ${user.oldLoginIp}&nbsp;&nbsp;&nbsp;时间：<fmt:formatDate value="${user.oldLoginDate}" type="both" dateStyle="full"/></label>
					<div>
						<sys:singleImageUploador id="avatar" name="上传头像" className="image-upload-btn" objectId="${user.id}" objectType="user" callback="afterUploaded(data);"/>
					</div>
				</div>
			</div>
			
		</div>
		<div class="box">
			<ul class="nav nav-tabs ">
				<li class="active"><a href="#">用户信息</a></li>
			</ul>
				<div class="box-main clearfix">
				<h4 class="title-left">个人信息</h4>
				<div class="col-sm-6">
					<div class="form-group">
						<label class="control-label inf-sty">用户类型:</label>
						<div class="controls col-sm-8">
							<div class="ipt">${fns:getDictLabel(user.userType, 'sys_user_type', '无')}</div>
						</div>
					</div>
					<div class="form-group">
						<label class="control-label inf-sty">归属公司:</label>
						<div class="controls col-sm-8">
							<div class="ipt">${user.company}</div>
						</div>
					</div>
					
				</div>
				<div class="col-sm-6">
					<div class="form-group">
						<label class="control-label inf-sty ">用户角色:</label>
						<div class="controls col-sm-8">
							<div class="ipt">${user.roleNames}</div>
						</div>
					</div>
					<div class="form-group">	
						<label class="control-label inf-sty ">归属部门:</label>
						<div class="controls col-sm-8">
							<div class="ipt">${user.office}</div>
						</div>
					</div>	
				</div>
				<h4 class="title-left">联系信息</h4>
				<div class="col-sm-6">
					<div class="form-group">
						<label class="control-label inf-sty">邮箱:</label>
						<div class="controls col-sm-8">
							<form:input path="email" htmlEscape="false" maxlength="50" class="email form-control " />
						</div>
					</div>
					<div class="form-group">
						<label class="control-label inf-sty">手机:</label>
						<div class="controls col-sm-8">
							<form:input path="mobile" htmlEscape="false" maxlength="50" class="form-control"/>
						</div>
					</div>			
				</div>
				<div class="col-sm-6">
					<div class="form-group">	
						<label class="control-label inf-sty ">电话:</label>
						<div class="controls col-sm-8">
							<form:input path="phone" htmlEscape="false" maxlength="50" class="form-control "/>
						</div>
					</div>
				</div>
				<div class="col-sm-12">
					<div class="form-group">
						<label class="control-label inf-sty">备注:</label>
						<div class="controls col-sm-10">
							<form:textarea path="remarks" htmlEscape="false" rows="3" maxlength="200" class="input-xlarge form-control"/>
						</div>
					</div>
				</div>
				<div class="form-group ">
					<div class="btn-middle"><input id="btnSubmit" class="btn btn-primary" type="submit" value="保 存"/></div>
				</div>
			</div>
		</div>
	</form:form>
	</div>
</body>
</html>